package com.example.javatwo.controller.cg.djg;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.example.javatwo.pojo.cg.djg.Product_d;
import com.example.javatwo.pojo.cg.djg.Supplier_d;
import com.example.javatwo.service.cg.djg.SupplierOrProductService;

@Controller
@RequestMapping("/suppOrProd/")
public class SupplierOrProductController {

	@Autowired
	private SupplierOrProductService supplierOrProductService;
	
	/**
	 * 页面跳转
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/supplier")
	public String supplier() throws Exception{
		return "cg/djg/supplier_d_h";
	}
	
	/**
	 * 页面跳转
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/product")
	public String product() throws Exception{
		return "cg/djg/product_d_h";
	}
	
	/**
	 * 页面跳转ssssss
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/products")
	@ResponseBody
	public List<Product_d> products() throws Exception{
		return this.supplierOrProductService.fandProduct();
	}
	
	/**
	 * 查询所有供应商
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/fandSupplier")
	@ResponseBody
	public Object fandSupplier() throws Exception{
		return  supplierOrProductService.fandSupplier();
	}
	
	
	/**
	 * 查询所有物料信息
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/fandProduct")
	@ResponseBody
	public Object fandProduct() throws Exception{
		return  supplierOrProductService.fandProduct();
	}
}
